//
//  NewsInfoShowCell.m
//  GuShiNews
//
//  Created by huachun on 2019/8/16.
//  Copyright © 2019 Jones. All rights reserved.
//

#import "NewsInfoShowCell.h"
#import "NewsModel.h"

@interface NewsInfoShowCell ()

@property (nonatomic, strong) UILabel *Label_tittle;

@end

@implementation NewsInfoShowCell

+ (instancetype)cellForTableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"NewsInfoShowCell";
    
    NewsInfoShowCell  *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell)
    {
        cell = [[NewsInfoShowCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
        
        cell.backgroundColor          = [UIColor whiteColor];
        
        [cell.contentView addSubview:cell.Label_tittle];
        
    }
    
    return cell;
}

- (void)setModel:(NewsModel *)Model{
    if (_Model != Model) {
        _Model = Model;
    }
    
    _Label_tittle.frame = CGRectMake(25, 15, RECRWITCH-50, _Model.info_height);
    
    NSDictionary *dic = @{NSKernAttributeName:@0.f};
    NSMutableAttributedString * attributedString =     [[NSMutableAttributedString alloc] initWithString:_Model.news_info attributes:dic];
    
    NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc]     init];
    [paragraphStyle setLineSpacing:3];
    
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [_Model.news_info length])];
    [_Label_tittle setAttributedText:attributedString];
    [_Label_tittle sizeToFit];
    
//    _Label_tittle.text = _Model.news_info;
}

-(UILabel *)Label_tittle{
    if (!_Label_tittle) {
        _Label_tittle           = [[UILabel alloc] init];
        _Label_tittle.font      = [UIFont systemFontOfSize:17];
        _Label_tittle.textColor = [JonesClass stringTOColor:@"#202020"];
        _Label_tittle.numberOfLines = 0;
    }
    return _Label_tittle;
}

@end
